package com.rabbitmq.rabbitmqqos.config;

import com.rabbitmq.rabbitmqqos.constant.Constants;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {

    /**
     * 创建仲裁队列
     * @return
     */
    @Bean("quorumQueue")
    public Queue quorumQueue() {
        return QueueBuilder.durable(Constants.QUORUM_QUEUE).quorum().build();
    }

    /**
     * haproxy 负载均衡
     * @return
     */
    @Bean("haproxyQueue")
    public Queue haproxyQueue() {
        return QueueBuilder.durable(Constants.HAPROXY_QUEUE).quorum().build();
    }
}
